package com.example.order;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;

import java.util.Date;
import java.util.concurrent.TimeUnit;

@SpringBootApplication
@EnableFeignClients
public class OrderNacosApplication {

    public static void main(String[] args) throws InterruptedException {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(OrderNacosApplication.class, args);
        while (true) {
            String name = applicationContext.getEnvironment().getProperty("user.name");
            String age = applicationContext.getEnvironment().getProperty("user.age");
            String config = applicationContext.getEnvironment().getProperty("user.config");
            System.out.println(new Date().getMinutes() + ":" + new Date().getSeconds());
            System.out.println("name = " + name);
            System.out.println("age = " + age);
            System.out.println("config = " + config);
            System.out.println();
            TimeUnit.SECONDS.sleep(3);
        }

    }


//    @Bean
//    @LoadBalanced
//    public RestTemplate restTemplate(RestTemplateBuilder builder) {
//        return builder.build();
//    }
}
